package cn.zyl.demo.common.permanent;

import cn.zyl.demo.common.constant.CommonConstant;
import cn.zyl.demo.common.enums.MsgEnum;
import cn.zyl.demo.common.exception.ToolsException;

import java.util.ResourceBundle;

/**
 * CommonMsgProperties类说明:提示信息配置文件获取-单例
 *
 * @author wsz
 * @version v1.0
 * @date 2020-07-23
 */
public class MsgProperties {
    private static final String PATH = "i18n.common_msg";
    private static final ResourceBundle BUNDLE;
    /* 静态初始化 */
    static{
        BUNDLE = ResourceBundle.getBundle(PATH);
    }
    public static String get(MsgEnum key){
        ToolsException.isTrueThrow(null == key, CommonConstant.MSG_KEY_EMPTY);
        return BUNDLE.getString(key.getKey());
    }
}
